﻿namespace NetFx.SMIL.Definitions
{
  using System;
  using System.Text;
  using System.Collections;
  using System.Collections.Generic;

  using System.Reflection;
  using System.Reflection.Emit;
  using System.Runtime.InteropServices;

  using System.Diagnostics;
  using System.Diagnostics.CodeAnalysis;
  using System.Diagnostics.SymbolStore;
  using System.Security;
  using System.Security.Permissions;

  using NetFx.MSIL;
  using NetFx.SMIL.References;

  public class LogicDef : ReflectDef
  {
    #region Statics
    public static LogicDef of(MethodDef method)
    {
      return new LogicDef(name);
    }
    #endregion
    #region Fields
    protected MethodDef method = null;
    protected byte[] ilCodes = null;
    #endregion
    #region Properties
    public override DefType DefinitionType
    {
      get { return DefType.Logic; }
    }
    public virtual byte[] ILCodes
    {
      get
      {
        return this.ilCodes;
      }
      set
      {
        this.ilCodes = value;
      }
    }
    #endregion
    #region Constructors
    public LogicDef(MethodDef method)
      : base(String.Empty)
    {
      if (method == null) throw new ArgumentNullException("method can not be null!");
      this.method = method;
    }
    #endregion
    #region Methods
    protected override AnyGenerator OnCompletingDefining(AnyGenerator generator)
    {
      return base.OnCompletingDefining(generator);
    }
    protected override AnyGenerator OnDefining(AnyGenerator container)
    {
      if (container is MethodGenerator)
      {
        return ((MethodGenerator)container).Generator;
      }
      return base.OnDefining(container);
    }
    protected override ReflectDef OnReflecting(object source)
    {
      //TODO: ADD: GET VARIABLE INFO FROM METHOD
      return base.OnReflecting(source);
    } 
    #endregion
  }
}